package com.xt.website_manager;

import com.xt.website_manager.util.MyInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author: jiangyu
 * @Date: 2019/9/3 14:36
 * @Description:
 */
@SpringBootConfiguration
public class MyWebMvcConfig implements WebMvcConfigurer {

    @Resource
    private MyInterceptor myInterceptor;

    /**
     * addInterceptors添加拦截规则
     * excludePathPatterns 排除拦截
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/**/*.html");
    }

}
